home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lantools / blueprnt / console.mod < prev    next >
Text File  |  1989-09-27  |  3KB  |  103 lines

  1. ;************************************************************
  2. ;* Console Output Module                      (CONSOLE.MOD) *
  3. ;* by Craig Chaiken                                         *
  4. ;* January 28, 1988                                         *
  5. ;*                                                          *
  6. ;* Function: Controls All Console I/O                       *
  7. ;************************************************************
  8. background      db      0       ;Run In Background Mode when Byte > 0
  9.  
  10. escape  proc    near            ;*** Exit to DOS if ESC Key is Sensed ***
  11.         cmp     byte ptr cs:background,1
  12.         jz      escap1
  13.         call    esctst
  14.         jnz     escap1
  15.         int     20h
  16. escap1: ret
  17. escape  endp
  18.  
  19. esctst  proc    near            ;*** Return Z Flag is ESC Key is Sensed ***
  20.         mov     ah,1
  21.         int     16h
  22.         jz      escts2
  23. escts1: xor     ah,ah
  24.         int     16h
  25.         cmp     al,27
  26.         ret
  27. escts2: xor     al,al
  28.         cmp     al,1
  29.         ret
  30. esctst  endp
  31.  
  32. cls     proc    near            ;clear screen
  33.         push    ax
  34.         push    bx
  35.         mov     ah,0fh
  36.         int     10h
  37.         mov     ah,0
  38.         int     10h
  39.         pop     bx
  40.         pop     ax
  41.         ret
  42. cls     endp
  43.  
  44. charout proc    near            ;display character in al to console
  45.         cmp     cs:background,1
  46.         jz      charo1
  47.         push    ax
  48.         push    bx
  49.         mov     ah,0eh
  50.         xor     bx,bx
  51.         int     10h
  52.         pop     bx
  53.         pop     ax
  54. charo1: ret
  55. charout endp
  56.  
  57. decout  proc    near            ;display decimal of unsigned integer in ax
  58.         push    ax
  59.         push    bx
  60.         push    dx
  61.         push    ax
  62.         mov     al,':'
  63.         call    charout
  64.         pop     dx
  65.         mov     bx,10000
  66.         call    decou1
  67.         mov     bx,1000
  68.         call    decou1
  69.         mov     bx,100
  70.         call    decou1
  71.         mov     bx,10
  72.         call    decou1
  73.         mov     bx,1
  74.         call    decou1
  75.         pop     dx
  76.         pop     bx
  77.         pop     ax
  78.         ret
  79. decou1: mov     ax,dx
  80.         xor     dx,dx
  81.         div     bx
  82.         add     al,'0'
  83.         jmp     charout
  84. decout  endp
  85.  
  86. messout proc    near            ;display message at DS:DI to console
  87.         push    ax
  88.         push    di
  89. messo1: mov     al,[di]
  90.         or      al,al
  91.         jz      messo2
  92.         call    charout
  93.         inc     di
  94.         jmp     messo1
  95. messo2: pop     di
  96.         pop     ax
  97.         ret
  98. messout endp
  99.  
  100. ;************************************************************
  101. ;* End of Console I/O Module                                *
  102. ;************************************************************
  103.